Crispo - Excel Challenge 26 2025

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

June 29, 2025

Illustration for Crispo - Excel Challenge 26 2025

Challenge Description

Easy Sunday Excel Challenge

⭐ Problem Solution Item Values Level Gender

Solutions

library(tidyverse)
library(readxl)

path = "files/2025-06-29/Challenge 37.xlsx"
input = read_excel(path, range = "B3:F10")
test  = read_excel(path, range = "H3:O4") %>% 
  rename(Item = `...1`)

result = input %>%
  mutate(Col = coalesce(Level, Gender, Location)) %>%
  select(-c(Level, Gender, Location)) %>%
  pivot_wider(names_from = Col, values_from = Values) 

all.equal(result, test)
# > [1] TRUE
  • Logic:

    • Reads the workbook range needed for the challenge

    • Reshapes the data to the grain required by the task

    • Builds the intermediate helper columns that drive the final answer

  • Strengths:

    • The R solution stays compact and mirrors the workbook logic closely.
  • Areas for Improvement:

    • The code assumes the workbook layout and named ranges remain stable.
  • Gem:

    • The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd

path = "files/2025-06-29/Challenge 37.xlsx"

input = pd.read_excel(path, usecols="B:F", skiprows=2, nrows=8)
test = pd.read_excel(path, usecols="H:O", skiprows=2, nrows=1)
test = test.rename(columns={test.columns[0]: "Item"})

input['Col'] = input[['Level', 'Gender', 'Location']].bfill(axis=1).iloc[:, 0]
result = input.pivot(index='Item', columns='Col', values='Values').reset_index()[test.columns]

print(result.equals(test)) # True
  • Logic:

    • Reads the workbook range needed for the challenge

    • Reshapes the data to the grain required by the task

  • Strengths:

    • The Python version keeps the same rule in a direct pandas-oriented workflow.
  • Areas for Improvement:

    • As with the R version, any workbook layout change would require small adjustments.
  • Gem:

    • The implementation stays close to the stated challenge instead of adding unnecessary complexity.

Difficulty Level

This task is moderate:

  • It combines familiar Excel-style logic with at least one non-trivial reshape, grouping, or parsing step.

  • The answer depends on getting the output layout exactly right.